package cn.xianshu.feign.clients;

import cn.xianshu.domain.User;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;


@Component
public class HystrixClientFallback implements FallbackFactory<UserFeignClient> {


    @Override
    public UserFeignClient create(Throwable throwable) {
        return new UserFeignClient() {
            @Override
            public User getById(Long id) {
                return new User(-1L, "", "系统异常，没有获取到用户信息!");
            }
        };
    }
}
